package com.jifeng.br.pjj.bookreader.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jifeng.br.pjj.bookreader.entity.NoticeEntity;
import com.jifeng.br.pjj.bookreader.mapper.NoticeMapper;
import com.jifeng.br.pjj.bookreader.service.NoticeService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * <p>
 * 系统公告表 服务实现类
 * </p>
 *
 * @author 机蜂
 * @since 2023-07-11
 */
@Service
@Transactional
public class NoticeServiceImpl extends ServiceImpl<NoticeMapper, NoticeEntity> implements NoticeService {

    @Override
    public IPage<NoticeEntity> getPage(int page, int limit, NoticeEntity notice) {
        return this.page(new Page<>(page, limit), new QueryWrapper<NoticeEntity>()
                .eq(notice.getStatus() != null, "status", notice.getStatus())
                .orderByDesc("id")
        );
    }
}
